package com.zy.reflect.adv_proxy;

import java.lang.reflect.Proxy;

/**
 * @Author Gong
 * @Description
 * @dATE 2021/12/21 11:26
 **/
public class MyProxy {
    //动态的创建一个代理类的对象
    public static Object getProxyInstance(Object obj){
        MyInvocationHanlder myInvoke=new MyInvocationHanlder();
        myInvoke.setObject(obj);
        return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), myInvoke);
    }

}
